package com.tian.arch

import android.content.Context
import com.tian.arch.base.BaseApplication
import kotlin.properties.Delegates

object Foundation {

    @JvmStatic
    private var INSTANCE: BaseApplication by Delegates.notNull()

    @JvmStatic
    fun init(context: BaseApplication) {
        INSTANCE = context
    }


    /**
     * 在新的as中(as dolphin和以后)，不要在自定义view中使用 Foundation.context(), 会导致布局无法预览
     */
    @JvmStatic
    fun context(): Context = INSTANCE

    @JvmStatic
    fun globalConfig(): GlobalConfig = INSTANCE.createGlobalConfig()

}